package com.kaifamiao.N0720;

public class Node2 {
    public static void main(String[] args) {
        double[] num1 = new double[5];
        for (int i = 0; i < num1.length; i++) {
            double num = Math.random();
            num1[i] = num;
        }
        System.out.println("排序前：");
        for (int i = 0; i < num1.length; i++) {
            System.out.print(num1[i] + "\t");
        }
        //冒泡排序
        for (int i = 0; i < num1.length - 1; i++) {
            for (int x = 0; x < num1.length - 1 - i; x++) {
                if (num1[x] < num1[x + 1]) {
                    double y = num1[x];
                    num1[x] = num1[x + 1];
                    num1[x + 1] = y;
                }
            }
        }
        System.out.println("\n" + "排序后：");
        for (int t = 0; t < num1.length; t++) {
            System.out.print(num1[t] + "\t");
        }
    }
}